<html>
<head>
<title>Scenario 2.1.</title>
</head>

<body>
<h3>Scenario 2.1.</h3>

<p>
Like <a href="scenarion1p1a.html">1.1</a>, but if and only if the
entire set of examples is valid with respect to Suite Foo, user wants
to update Discrimination definitions using these examples.

<p><strong>Implementation</strong>


<p>For simplicity, we assume below that the entire set comes in a
single "dataset" XML element, and we only care about the first
unacceptable example. We therefore use the simple method
ParseXML.validateDatasetElement(...) for validation.  Otherwise, you
can use ParseXML.validateDatasetElement2(...) as shown
in <a href="scenario-1p1a.html">Scenario 1.1(a)</a>.

<pre>
  Suite suite = new Suite("foo.xml"); // create suite...
  // modify suite by any preceding definitional parsing etc
  ....                                
  // validate the set of examples from dataset XML
  // a "datapoint" element
  boolean isDefinitional = true;
  String f ="dataset.xml"; 
  org.w3c.dom.Element e = ParseXML.readFileToElement(f); 
  int n=ParseXML.validateDatasetElement(e, suite, isDefinitional);
  if (n &gt; 0) {
	System.out.println("[VALIDATE] The data set from file " + f + 
        " appears to be fully acceptable as a training set in the current suite."+
        " It contains " + n + " data points");
        // now, parse the date with the "real" suite. Definitional parsing is
        // used, so the suite is updated as we go
        Vector &lt;DataPoint&gt; v = ParseXML.parseDatasetElement(e, suite, isDefinitional);

  } else {
	 System.out.println("[VALIDATE] It would not be possible to parse the data set from file " +
         f + " as a training set in the current suite. "+
         "Please see a warning log message for detals");
  }

</pre>	

<hr>

Back to <a href="standard-scenarios.html">All scenarios</a>

</body>
</html>
